package com.qf.springmvc02.controller;

import com.qf.springmvc02.entity.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static java.awt.SystemColor.text;

@RestController
@RequestMapping("/json")
public class JsonController {
    @RequestMapping("test1")
    public User test1(){
        User user = new User();
        user.setUsername("赵四");
        user.setPassword("123456");
        return user;
    }
    @GetMapping("test2")
    public User test2(){
        User user = new User();
        user.setUsername("王五");
        user.setPassword("123456");
        return user;
    }
    @GetMapping({"test3","test4"})
    public User test3(){
        User user = new User();
        user.setUsername("刘能");
        user.setPassword("123456");
        return user;
    }
    @RequestMapping(value = "test5",produces = "text/html;charset=UTF-8")
    public String test5(){
        return "你好";
    }

    @RequestMapping("test6")
    public User test6(@RequestBody User user){
        System.out.println(user);
        return user;
    }
}
